import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';

class PromptAction {
  // 通用的提示框
  static showInfo(String msg) {
    Fluttertoast.showToast(
      // 提示框的内容
      msg: msg,
      //提示时长
      toastLength: Toast.LENGTH_SHORT,
      // 提示框出现的位置
      gravity: ToastGravity.BOTTOM,
      // 提示框的背景颜色
      webBgColor: '#58b6f0',
      //提示框的位置
      webPosition: 'center',
      // 提示框的文字颜色
      textColor: Colors.white,
    );
  }

  // 获取数据成功提示
  static showSuccess(String msg) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      webBgColor: '#98b756',
      webPosition: 'center',
      textColor: Colors.white,
    );
  }

  // 获取数据失败提示
  static showError(String msg) {
    Fluttertoast.showToast(
      msg: msg,
      toastLength: Toast.LENGTH_SHORT,
      gravity: ToastGravity.BOTTOM,
      webBgColor: '#ff5555',
      webPosition: 'center',
      textColor: Colors.white,
    );
  }
}
